<link rel="stylesheet" type="text/css" href="assets/bootstrap-datepicker/css/datepicker.css" />
<section id="main-content">
  <section class="wrapper">
    <!--state overview end-->
    <form>
      <div class="row">
        <div class="col-lg-12">
          <section class="panel">
            <header class="panel-heading">
              立项信息
            </header>
            <div class="panel-body">

              <div class="form-group customerForm">
                <label class="col-sm-2 control-label">项目类型*</label>
                <div class="col-sm-10">
                  <select name="proType" class="form-control" ng-change="changetp()"
                          ng-model="proType" disabled>
                      <option value="XS" selected>销售类项目</option>
                      <option value="ZL">战略类项目</option>
                      <option value="YF">研发类项目</option>
                      <option value="BM">部门类项目</option>
                      <option value="SW">事务类项目</option>
                      <option value="CS">内部测试类项目</option>
                  </select>
                </div>
              </div>
              <div class="form-group customerForm">
                <label class="col-sm-2 control-label">所属公司*</label>
                <div class="col-sm-10">
                  <select name="company" class="form-control" id="company" ng-model="company" ng-change="changeComp()">
                    <option value="">请选择</option>
                    <option value="HFXX">浩方信息</option>
                    <option value="HFKJ">浩方科技</option>
                    <option value="STSNJ">赛特斯南京</option>
                    <option value="STSBJ">赛特斯北京</option>
                    <option value="STSSH">赛特斯上海</option>
                    <option value="STSGD">赛特斯广东</option>
                  </select>
                </div>
              </div>
              <!--<div class="form-group customerForm" ng-if="showArea">-->
                <!--<label class="col-sm-2 control-label">项目区域</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<select name="area" class="form-control" certus-required>-->
                    <!--<option value="">请选择</option>-->
                    <!--<option ng-repeat="d in area" value="{{d.city}}">{{d.city}}</option>-->
                  <!--</select>-->
                <!--</div>-->
              <!--</div>-->
              <div class="form-group customerForm" ng-if="showCus">
                <label class="col-sm-2 control-label">客户名称</label>
                <div class="col-sm-10">
                    <input type="text" id="cus" name="cusName" class="form-control" placeholder="客户名称自动检索。如果没有，请到左侧菜单《我的项目》下《客户列表》下新建客户"
                           onkeyup="return banInputSapce(event);">
                    <input type="hidden" value="" name="cusId" id="cusId" certus-required/>
                </div>
              </div>
              <div class="form-group customerForm">
                <label class="col-sm-2 control-label">项目名称</label>
                <div class="col-sm-10">
                  <input type="text" value="" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');" maxlength="200"
                    certus-required id="proName" name="proName" class="form-control">
                </div>
              </div>


              <!--<div class="form-group customerForm" ng-if="showCompare">-->
                <!--<label class="col-sm-2 control-label">预计比拼类测试</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<select id="isCompare" name="isCompare" class="form-control" certus-required>-->
                    <!--<option value="">请选择</option>-->
                    <!--<option value="1">有</option>-->
                    <!--<option value="0">无</option>-->
                  <!--</select>-->
                <!--</div>-->
              <!--</div>-->
              <!--<div class="form-group customerForm" ng-show="showSign">-->
                <!--<label class="col-sm-2 control-label">预签单日期</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<input id="datetimeYjd" type="text" name="divineSignDate" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');"-->
                     <!--value="" class="form-control">-->
                <!--</div>-->
              <!--</div>-->
              <!--<div class="form-group customerForm" ng-show="showHk">-->
                <!--<label class="col-sm-2 control-label">预回款日期</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<input id="datetimeYhk" type="text" name="divineHkDate" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');"-->
                     <!--value="" class="form-control">-->
                <!--</div>-->
              <!--</div>-->
              <!--<div class="form-group customerForm" ng-show="showFinish">-->
              <!--<label class="col-sm-2 control-label">预计完成时间</label>-->
              <!--<div class="col-sm-10">-->
              <!--<input id="datetime-3" name="divineFinishTime" certus-required type="text" value="" class="form-control">-->
              <!--</div>-->
              <!--</div>-->
              <div class="form-group customerForm" ng-show="showVersion">
                <label class="col-sm-2 control-label">预计版本发布时间</label>
                <div class="col-sm-10">
                  <input id="datetimeFb" name="divineVersionTime" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');"
                    certus-required type="text" value="" class="form-control">
                </div>
              </div>
              <div class="form-group customerForm">
                <label class="col-sm-2 control-label">项目周期*</label>
                <div class="col-sm-10">
                  <input id="datetimeKs" name="startTime" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');" placeholder="开始日期"
                    type="text" value="" style="width: 48%;" class="form-control">
                  <input id="datetimeJs" name="endTime" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');"
                    type="text" placeholder="结束日期" style="width:48%;position:absolute;left: 50%;bottom: 0px;" value=""
                    class="form-control">
                </div>
              </div>
              <div class="form-group customerForm">
                <label class="col-sm-2 control-label">所属产品*</label>
                <div class="col-sm-10">
                  <select name="product" id="product" class="form-control">
                    <option value="">请选择</option>
                    <option ng-repeat="d in productList" value="{{d.productCode}}">{{d.productName}}</option>
                  </select>
                </div>
              </div>
                <!--<div class="form-group customerForm" id="pdLine" ng-show="showPolucy">-->
                    <!--<label class="col-sm-2 control-label">产品线*</label>-->
                    <!--<div class="col-sm-10">-->
                        <!--&lt;!&ndash;start&ndash;&gt;-->
                        <!--<div ng-repeat="x in dd">-->
                            <!--<div ng-repeat="d in x.deptList">-->
                                <!--<div class="checkbox">-->
                                    <!--<label>-->
                                        <!--<input type="checkbox" onclick="ckIsN(this.value)" value="{{d.departmentCode}}">-->
                                        <!--{{d.departmentName}}-->
                                    <!--</label>-->
                                <!--</div>-->
                            <!--</div>-->
                        <!--</div>-->
                        <!--<div class="checkbox">-->
                            <!--<label>-->
                                <!--<input type="checkbox" onclick="ckIsN(this.value)" value="N"> 无-->
                            <!--</label>-->
                        <!--</div>-->
                        <!--&lt;!&ndash;end&ndash;&gt;-->
                    <!--</div>-->
                <!--</div>-->
              <div class="form-group customerForm">
                <label class="col-sm-2 control-label">项目经理</label>
                <div class="col-sm-10">
                  <input type="text" value="" id="proMgName" name="proMgName" class="form-control" certus-required>
                  <input type="hidden" value="" name="proMgId" id="proMgId"/>
                </div>
              </div>

              <!--<div class="form-group customerForm">-->
                <!--<label class="col-sm-2 control-label">销售经理</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<input type="text" value="" id="proXsName" name="proXsName" class="form-control">-->
                  <!--<input type="hidden" value="" name="proXsId" id="proXsId"/>-->
                <!--</div>-->
              <!--</div>-->

              <!--<div class="form-group customerForm">-->
                <!--<label class="col-sm-2 control-label">产品经理</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<input type="text" value="" id="proCpName" name="proCpName" class="form-control">-->
                  <!--<input type="hidden" value="" name="proCpId" id="proCpId"/>-->
                <!--</div>-->
              <!--</div>-->

              <!--<div class="form-group customerForm">-->
                <!--<label class="col-sm-2 control-label">交付经理</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<input type="text" value="" id="proJfName" name="proJfName" class="form-control">-->
                  <!--<input type="hidden" value="" name="proJfId" id="proJfId"/>-->
                <!--</div>-->
              <!--</div>-->
              <div class="form-group customerForm">
                <label class="col-sm-2 control-label">立项说明</label>
                <div class="col-sm-10">
                  <textarea class="form-control" name="lxDesc" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');"
                    maxlength="120" placeholder="最多120个字"></textarea>
                </div>
              </div>
              <!--<div class="form-group customerForm">-->
                <!--<label class="col-sm-2 control-label">优先级</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<select name="proLv" class="form-control" id="proLv">-->
                    <!--<option value="3">高</option>-->
                    <!--<option value="2" selected>中</option>-->
                    <!--<option value="1">低</option>-->
                  <!--</select>-->
                <!--</div>-->
              <!--</div>-->

              <!--<div class="form-group customerForm">-->
                <!--<label class="col-sm-2 control-label">紧急性</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<select name="urgency" class="form-control" id="urgency">-->
                    <!--<option value="0">不紧急</option>-->
                    <!--<option value="1">紧急</option>-->
                  <!--</select>-->
                <!--</div>-->
              <!--</div>-->
              <!--<div class="form-group customerForm">-->
                <!--<label class="col-sm-2 control-label">重要性</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<select name="importance" class="form-control" id="importance">-->
                    <!--<option value="0">一般</option>-->
                    <!--<option value="1">重要</option>-->
                    <!--<option value="2">战略</option>-->
                  <!--</select>-->
                <!--</div>-->
              <!--</div>-->
              <!--<div class="form-group customerForm">-->
                <!--<label class="col-sm-2 control-label">价值点描述</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<textarea class="form-control" name="clueDesc" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');"-->
                            <!--maxlength="250" placeholder="最多250个字"></textarea>-->
                <!--</div>-->
              <!--</div>-->
              <!--<div class="form-group customerForm" ng-if="showPolucy">-->
                <!--<label class="col-sm-2 control-label">客户决策链和关键描述</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<textarea class="form-control" name="cusPolicy" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');"-->
                            <!--maxlength="250" placeholder="最多250个字"></textarea>-->
                <!--</div>-->
              <!--</div>-->
              <!--<div class="form-group customerForm" ng-if="showCompe">-->
                <!--<label class="col-sm-2 control-label">竞争信息</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<textarea class="form-control" name="competitor" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');"-->
                            <!--maxlength="250" placeholder="最多250个字"></textarea>-->
                <!--</div>-->
              <!--</div>-->
              <!--<div class="form-group customerForm">-->
                <!--<label class="col-sm-2 control-label">沟通确认</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<span class="doprocheck" style="line-height:normal;">-->
                    <!--<div class="checkbox">-->
                      <!--<label>-->
                        <!--<input id="remember" value="remember-me" type="checkbox"> 经过和相关领导确认，本人兼任此项目的项目经理，故一并提交商务预测。-->
                      <!--</label>-->
                    <!--</div>-->
                  <!--</span>-->
                <!--</div>-->
              <!--</div>-->
              <!--<div class="hideprobox">-->
                <!--<div class="form-group customerForm">-->
                  <!--<label class="col-sm-2 control-label">沟通结果</label>-->
                  <!--<div class="col-sm-10">-->
                    <!--<textarea class="form-control" name="result" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');"-->
                      <!--certus-required maxlength="120"></textarea>-->
                  <!--</div>-->
                <!--</div>-->
              <!--</div>-->
            </div>
          </section>

          <section class="panel hiderl" style="display: none;">
            <header class="panel-heading">
              人天预估
            </header>
            <div class="panel-body">

              <div class="form-group customerForm">
                <label class="col-sm-2 control-label">角色*</label>
                <div class="col-sm-10">
                  <select name="rluserName" id="rluserName" class="form-control">
                    <option value="">请选择</option>
                    <option ng-repeat="d in rlList" value="{{d.roleId}}">{{d.roleName}}</option>
                  </select>
                </div>
              </div>
              <div class="form-group customerForm">
                <label class="col-sm-2 control-label">级别*</label>
                <div class="col-sm-10">
                  <select name="rtMoney" class="form-control" id="rtMoney">
                    <option value="1">低</option>
                    <option value="2">中</option>
                    <option value="3">高</option>
                  </select>
                </div>
              </div>

              <div class="form-group customerForm">
                <label class="col-sm-2 control-label">周期*</label>
                <div class="col-sm-10">
                  <input id="rlBeginTime" name="rlBeginTime" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');" placeholder="开始日期"
                         type="text" value="" style="width: 48%;" class="form-control">
                  <input id="rlEndTime" name="rlEndTime" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');"
                         type="text" placeholder="结束日期" style="width:48%;position:absolute;left: 50%;bottom: 0px;" value=""
                         class="form-control">
                </div>
              </div>
              <div class="form-group customerForm">
                <label class="col-sm-2 control-label">单人天数*</label>
                <div class="col-sm-10">
                  <input type="text" onkeyup="clearNoNum(this)" autocomplete="off" onblur="clearNoNum(this)" min="1" value=""
                         max="500" id="rtNum" class="form-control">
                </div>
              </div>
              <div class="form-group customerForm">
                <label class="col-sm-2 control-label">人数*</label>
                <div class="col-sm-10">
                  <input type="text" onkeyup="clearNoNum(this)" autocomplete="off" onblur="clearNoNum(this)" min="1" value=""
                        max="500" id="pNum" class="form-control">
                </div>
              </div>

              <div class="form-group customerForm">
                <label class="col-sm-2 control-label">说明</label>
                <div class="col-sm-10">
                <textarea class="form-control" id="rlComments" autocomplete="off" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');"
                          maxlength="120" placeholder="字数限制(120字以内)"></textarea>
                </div>
              </div>
              <p class="default-buttons">
                <a href="javascript:void(0);" class="button-back btn btn-info" onclick="hideRl();">取消</a>
                <a href="javascript:void(0);" class="button-next  btn btn-info rlSubmit">提交</a>
              </p>
            </div>
        </section>
        <section class="panel hideprobox">
          <header class="panel-heading add-heading">
            人天预估
            <i class="add-icon icon-plus" onclick="showRl();"> 新增</i>
          </header>
          <div class="panel-body bio-graph-info">
            <div id="rlContainer" class="dlshouwen-grid-container"></div>
            <div id="rlToolBarContainer" class="dlshouwen-grid-toolbar-container"></div>
          </div>
        </section>
        <section class="panel hideother" style="display: none">
          <header class="panel-heading add-heading">
            费用信息
          </header>
          <div class="panel-body">
            <div class="form-group customerForm">
              <label class="col-sm-2 control-label">金额类型*</label>
              <div class="col-sm-10">
                <select name="moneyType" id="moneyType" class="form-control">
                  <option value="XSE">预计销售额</option>
                  <!--<option value="KH">客户交际费用</option>-->
                  <!--<option value="CL">差旅费用</option>-->
                  <!--<option value="CG">采购费用</option>-->
                  <!--<option value="QT">其他费用</option>-->
                  <!--<option value="RL">人力总成本</option>-->
                </select>
              </div>
            </div>
            <div class="form-group customerForm">
              <label class="col-sm-2 control-label">预算金额</label>
              <div class="col-sm-10">
                <input type="text" onkeyup="clearNoNum(this)" autocomplete="off" onblur="clearNoNum(this)" min="0" value=""
                       id="bugetMoney" certus-required class="form-control">
              </div>
            </div>
            <div class="form-group customerForm">
              <label class="col-sm-2 control-label">使用周期*</label>
              <div class="col-sm-10">
                <div class="row">
                  <div class="col-lg-6">
                    <input type="text" class="form-control" autocomplete="off" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');" certus-required
                           id="oStartTime" name="oStartTime" placeholder="开始日期">
                  </div>
                  <div class="col-lg-6">
                    <input type="text" class="form-control" autocomplete="off" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');" certus-required
                           id="oEndTime" name="oEndTime" placeholder="结束日期">
                  </div>
                </div>
              </div>
            </div>
            <div class="form-group customerForm">
              <label class="col-sm-2 control-label">事由</label>
              <div class="col-sm-10">
                <textarea class="form-control" id="comments" autocomplete="off" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');"
                          maxlength="120" placeholder="字数限制(120字以内)"></textarea>
              </div>
            </div>

            <p class="default-buttons">
              <a href="javascript:void(0);" class="button-back btn btn-info" onclick="hideother();">取消</a>
              <a href="javascript:void(0);" class="button-next  btn btn-info" onclick="addOtherMoney()">提交</a>
            </p>
          </div>
        </section>
        <section class="panel hideprobox">
          <header class="panel-heading add-heading">
            费用预估
            <i class="add-icon icon-plus" onclick="showother()"> 新增</i>
          </header>
          <div class="panel-body bio-graph-info">
            <div id="otherContainer" class="dlshouwen-grid-container"></div>
            <div id="otherToolBarContainer" class="dlshouwen-grid-toolbar-container"></div>
          </div>
        </section>
        <section class="panel tarhideproin" style="display: none;">
          <header class="panel-heading add-heading">
            目标信息
          </header>
          <div class="panel-body">

            <div class="form-group customerForm">
              <label class="col-sm-2 control-label">项目目标<span>*</span></label>
              <div class="col-sm-10">
                <textarea class="form-control" id="proTarget" autocomplete="off" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');" maxlength="120"
                  placeholder="字数限制(120字以内)"></textarea>
              </div>
            </div>
            <div class="form-group customerForm">
              <label class="col-sm-2 control-label">完成时间<span>*</span></label>
              <div class="col-sm-10">
                <input type="text" id="tarFinishTime" autocomplete="off" value="" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');"
                  class="form-control">
              </div>
            </div>

            <p class="default-buttons">
              <a href="javascript:void(0);" class="button-back btn btn-info" onclick="tarhideproin();">取消</a>
              <a href="javascript:void(0);" class="button-next  btn btn-info targetSubmit">提交</a>
            </p>
          </div>
        </section>

        <!--<section class="panel tarhideprobox">-->
          <!--<header class="panel-heading add-heading">-->
            <!--项目目标-->
            <!--<i class="add-icon icon-plus" onclick="showtarget();"> 新增</i>-->
          <!--</header>-->
          <!--<div class="panel-body bio-graph-info">-->
            <!--<div id="targetContainer" class="dlshouwen-grid-container"></div>-->
          <!--</div>-->
        <!--</section>-->

        <section class="panel hideproin" style="display: none;">
          <header class="panel-heading">
            指标信息
          </header>
          <div class="panel-body">

            <div class="form-group customerForm">
              <label class="col-sm-2 control-label">指标名称</label>
              <div class="col-sm-10">
                <input type="text" value="" id="wntyName" autocomplete="off" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');"
                  class="form-control" certus-required maxlength="50" placeholder="字数限制(50字以内)">
              </div>
            </div>
            <div class="form-group customerForm">
              <label class="col-sm-2 control-label">指标描述</label>
              <div class="col-sm-10">
                <textarea class="form-control" id="wntyDesc" autocomplete="off" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');" certus-required
                  maxlength="120" placeholder="字数限制(120字以内)"></textarea>
              </div>
            </div>
            <div class="form-group customerForm">
              <label class="col-sm-2 control-label">完成时间</label>
              <div class="col-sm-10">
                <input type="text" id="finishTime" value="" autocomplete="off" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');"
                  class="form-control" certus-required>
              </div>
            </div>

            <p class="default-buttons">
              <a href="javascript:void(0);" class="button-back btn btn-info" onclick="hideproin();">取消</a>
              <a href="javascript:void(0);" class="button-next  btn btn-info warnSubmit">提交</a>
            </p>
          </div>
        </section>
        <!--<section class="panel hideprobox">-->
          <!--<header class="panel-heading add-heading">-->
            <!--项目指标-->
            <!--<i class="add-icon icon-plus" onclick="showproin();"> 新增</i>-->
          <!--</header>-->
          <!--<div class="panel-body bio-graph-info">-->
            <!--<div id="proinContainer" class="dlshouwen-grid-container"></div>-->
            <!--<div id="proinToolBarContainer" class="dlshouwen-grid-toolbar-container"></div>-->
          <!--</div>-->
        <!--</section>-->
        <!--<section class="panel hideprobox">-->
            <!--<header class="panel-heading">-->
              <!--商务预测-->
            <!--</header>-->
            <!--<div class="panel-body">-->

              <!--<div class="form-group customerForm" ng-if="showMoney">-->
                <!--<label class="col-sm-2 control-label">销售额</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<input type="text" onkeyup="clearNoNum(this)" onblur="clearNoNum(this)" value="" min="0"-->
                    <!--name="divineMoney" certus-required class="form-control">-->
                <!--</div>-->
              <!--</div>-->
              <!--<div class="form-group customerForm" ng-if="showBudget">-->
                <!--<label class="col-sm-2 control-label">客户预算</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<input type="text" onkeyup="clearNoNum(this)" onblur="clearNoNum(this)" value="" min="0"-->
                    <!--name="cusBudget" certus-required class="form-control">-->
                <!--</div>-->
              <!--</div>-->
              <!--<hr />-->
              <!--<div class="form-group customerForm" ng-if="showCtMoney">-->
                <!--<label class="col-sm-2 control-label">客户交际费用</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<input type="text" onkeyup="clearNoNum(this)" onblur="clearNoNum(this)" value="" min="0"-->
                    <!--name="divineContactMoney" certus-required class="form-control">-->
                <!--</div>-->
              <!--</div>-->
              <!--<div class="form-group customerForm" ng-show="showCtMoney">-->
                <!--<label class="col-sm-2 control-label">使用周期*</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<div class="row">-->
                    <!--<div class="col-lg-6">-->
                      <!--<input type="text" class="form-control" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');" certus-required-->
                        <!--id="ctStartTime" name="ctStartTime" placeholder="开始日期">-->
                    <!--</div>-->
                    <!--<div class="col-lg-6">-->
                      <!--<input type="text" class="form-control" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');" certus-required-->
                        <!--id="ctEndTime" name="ctEndTime" placeholder="结束日期">-->
                    <!--</div>-->
                  <!--</div>-->
                <!--</div>-->
              <!--</div>-->
              <!--<div class="form-group customerForm" ng-show="showCtMoney">-->
                <!--<label class="col-sm-2 control-label">费用说明</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<input type="text" name="dcMoneyDesc" value="" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');"-->
                    <!--class="form-control" maxlength="120">-->
                <!--</div>-->
              <!--</div>-->
              <!--<hr />-->
              <!--<div class="form-group customerForm">-->
                <!--<label class="col-sm-2 control-label">差旅费用</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<input type="text" onkeyup="clearNoNum(this)" onblur="clearNoNum(this)" value="" min="0"-->
                    <!--name="divineBusinessMoney" maxlength="120" certus-required class="form-control">-->
                <!--</div>-->
              <!--</div>-->
              <!--<div class="form-group customerForm">-->
                <!--<label class="col-sm-2 control-label">使用周期*</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<div class="row">-->
                    <!--<div class="col-lg-6">-->
                      <!--<input type="text" class="form-control" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');" certus-required-->
                        <!--id="bsStartTime" name="bsStartTime" placeholder="开始日期">-->
                    <!--</div>-->
                    <!--<div class="col-lg-6">-->
                      <!--<input type="text" class="form-control" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');" certus-required-->
                        <!--id="bsEndTime" name="bsEndTime" placeholder="结束日期">-->
                    <!--</div>-->
                  <!--</div>-->
                <!--</div>-->
              <!--</div>-->
              <!--<div class="form-group customerForm">-->
                <!--<label class="col-sm-2 control-label">费用说明</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<input type="text" name="dbMoneyDesc" value="" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');"-->
                    <!--class="form-control" maxlength="120">-->
                <!--</div>-->
              <!--</div>-->
              <!--<hr />-->
              <!--<div class="form-group customerForm">-->
                <!--<label class="col-sm-2 control-label">采购费用</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<input type="text" onkeyup="clearNoNum(this)" onblur="clearNoNum(this)" value="" min="0"-->
                    <!--name="divinePurchaseMoney" certus-required class="form-control">-->
                <!--</div>-->
              <!--</div>-->
              <!--<div class="form-group customerForm">-->
                <!--<label class="col-sm-2 control-label">使用周期*</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<div class="row">-->
                    <!--<div class="col-lg-6">-->
                      <!--<input type="text" class="form-control" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');" certus-required-->
                        <!--id="phStartTime" name="phStartTime" placeholder="开始日期">-->
                    <!--</div>-->
                    <!--<div class="col-lg-6">-->
                      <!--<input type="text" class="form-control" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');" certus-required-->
                        <!--id="phEndTime" name="phEndTime" placeholder="结束日期">-->
                    <!--</div>-->
                  <!--</div>-->
                <!--</div>-->
              <!--</div>-->
              <!--<div class="form-group customerForm">-->
                <!--<label class="col-sm-2 control-label">费用说明</label>-->
                <!--<div class="col-sm-10">-->
                  <!--<input type="text" name="dpMoneyDesc" onkeyup="this.value=this.value.replace(/(^\s+)|(\s+$)/g,'');" value=""-->
                    <!--maxlength="120" class="form-control">-->
                <!--</div>-->
              <!--</div>-->

            <!--</div>-->
          <!--</section>-->
          <section class="panel">
            <div class="panel-body">
              <p class="default-buttons">
                <!--<a href="javascript:void(0);" class="button-back btn btn-info" onclick="window.history.back()">返回</a>-->
                <a href="javascript:void(0);" class="button-next  btn btn-success submit">确认提交</a>
              </p>
            </div>
          </section>
        </div>
      </div>
    </form>
  </section>
</section>
<!-- 当前页面js文件引入 -->
<script type="text/javascript" src="assets/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
<script>
  //时间控件
  // $('#datetimeYjd').datepicker({
  //   format: 'yyyy-mm-dd'
  // });
  // $('#datetimeYhk').datepicker({
  //   format: 'yyyy-mm-dd'
  // });
  $('#finishTime').datepicker({
    format: 'yyyy-mm-dd'
  });
  $("#datetime-3").datepicker({
    format: 'yyyy-mm-dd'
  });
  $("#datetimeFb").datepicker({
    format: 'yyyy-mm-dd'
  });
  $("#tarFinishTime").datepicker({
    format: 'yyyy-mm-dd'
  });
  $("#datetimeKs").datepicker({
    format: 'yyyy-mm-dd'
  });
  $("#datetimeJs").datepicker({
    format: 'yyyy-mm-dd'
  });
  $('#ctStartTime').datepicker({
    format: 'yyyy-mm-dd'
  });
  $('#ctEndTime').datepicker({
    format: 'yyyy-mm-dd'
  });
  $('#oStartTime').datepicker({
    format: 'yyyy-mm-dd'
  });
  $('#oEndTime').datepicker({
    format: 'yyyy-mm-dd'
  });

  $('#bsStartTime').datepicker({
    format: 'yyyy-mm-dd'
  });
  $('#bsEndTime').datepicker({
    format: 'yyyy-mm-dd'
  });

  $('#phStartTime').datepicker({
    format: 'yyyy-mm-dd'
  });
  $('#phEndTime').datepicker({
    format: 'yyyy-mm-dd'
  });
  $('#rlBeginTime').datepicker({
      format: 'yyyy-mm-dd'
  });
  $('#rlEndTime').datepicker({
      format: 'yyyy-mm-dd'
  });
</script>
<script type="text/javascript">
    function addNlx(CertusFormAjax, $routeParams, $scope) {
        $scope.proType = "XS";

        this.getArea = function (companyCode) {
            if (companyCode == undefined || companyCode == null || companyCode == "") {
                companyCode = $("#company").val();
            }
            CertusFormAjax.ajax("findRegionList", {
                "compCode": companyCode
            }, function (response) {
                $scope.area = response.data;
            });
        };

        this.getProduct = function (companyCode) {
            if (companyCode == undefined || companyCode == null || companyCode == "") {
                companyCode = $("#company").val();
            }
            CertusFormAjax.ajax("findIntroList", {
                "compCode": companyCode
            }, function (response) {
                $scope.productList = response.data;
            });
        };

        this.getRtList = function () {
            CertusFormAjax.ajax("getNlxRoles",{"company":$("#company").val()},function (response) {
                var data = response.data;
                $scope.rlList = data;
            });
        };

        $scope.changeComp = function () {
            var comp = "";
            if ($("#company").val()=="STSNJ"||$("#company").val()=="STSBJ"||
                $("#company").val()=="STSSH"||$("#company").val()=="STSGD"){
                comp = "STSJT";
            }else{
                comp = $("#company").val();
            }
            getProduct(comp);
            getRtList();
        };

        $scope.changetp = function () {
            if ($scope.proType == "XS") {
                $("#proName").attr("placeholder", "客户名称+产品名称");
                $("#clueLv").val("");
                $("#clueLv").prop("disabled", "");
                $("#urgency").val(0);
                $("#urgency").prop("disabled", "");
                $("#importance").val(0);
                $("#importance").prop("disabled", "");

                $("#datetimeKs").prop("disabled", "");
                $("#datetimeKs").val("");
                $("#datetimeJs").prop("disabled", "");
                $("#datetimeJs").val("");
            } else if ($scope.proType == "BM") {
                $("#proName").attr("placeholder", "部门+年份");
                $("#clueLv").val("2");
                $("#clueLv").prop("disabled", "disabled");
                $("#urgency").val(0);
                $("#urgency").prop("disabled", "disabled");
                $("#importance").val(0);
                $("#importance").prop("disabled", "disabled");

                var date = new Date;
                var year = date.getFullYear();
                $("#datetimeKs").prop("disabled", "disabled");
                $("#datetimeKs").val(year + "-01-01");
                $("#datetimeJs").prop("disabled", "disabled");
                $("#datetimeJs").val(year + "-12-31");
            } else {
                $("#clueLv").val("");
                $("#clueLv").prop("disabled", "");
                $("#proName").attr("placeholder", "");
                $("#urgency").val(0);
                $("#urgency").prop("disabled", "");
                $("#importance").val(0);
                $("#importance").prop("disabled", "");
                $("#datetimeKs").prop("disabled", "");
                $("#datetimeKs").val("");
                $("#datetimeJs").prop("disabled", "");
                $("#datetimeJs").val("");
            }

            $("#company").val("");
            $("#department").val("");
            $('#datetime').val("");
            $('#datetimeYhk').val("");
            $('#datetime-3').val("");
            $('#datetimeFb').val("");
            if ($scope.proType == "XS") {
                $scope.showArea = true;
                $scope.showCus = true;
                $scope.showCompare = true;
                $scope.showSign = true;
                $scope.showHk = true;
                $scope.showPolucy = true;
                $scope.showCompe = true;
                $scope.showMoney = true;
                $scope.showBudget = true;
                $scope.showCtMoney = true;
                $scope.showBsMoney = true;
                $scope.showPhMoney = true;
                $scope.showFinish = false;
                $scope.showVersion = false;
            } else if ($scope.proType == "ZL" || $scope.proType == "SW" ||
                $scope.proType == "BM") {
                $scope.showArea = false;
                $scope.showCus = false;
                $scope.showCompare = false;
                $scope.showSign = false;
                $scope.showHk = false;
                $scope.showPolucy = false;
                $scope.showCompe = false;
                $scope.showMoney = false;
                $scope.showBudget = false;
                $scope.showCtMoney = true;
                $scope.showBsMoney = true;
                $scope.showPhMoney = true;
                $scope.showFinish = true;
                $scope.showVersion = false;
            } else {
                $scope.showCtMoney = false;
                $scope.showArea = false;
                $scope.showCus = false;
                $scope.showCompare = false;
                $scope.showSign = false;
                $scope.showHk = false;
                $scope.showPolucy = false;
                $scope.showCompe = false;
                $scope.showMoney = false;
                $scope.showBudget = false;
                $scope.showBsMoney = true;
                $scope.showPhMoney = true;
                $scope.showVersion = true;
                $scope.showFinish = false;
            }
        };
        $scope.changetp();

        CertusFormAjax.ajax("findComList", {}, function (response) {
            var nhlTeams = [];
            var data = response.data;
            for (var i = 0; i < data.length; i++) {
                var arr = {};
                arr.name = data[i].comName + "（" + data[i].comShortName + "）-----" + data[i].userName;
                arr.id = data[i].id;
                nhlTeams.push(arr);
            }
            //自动补全
            var nhl = $.map(nhlTeams, function (obj) {
                return {
                    value: obj.name,
                    data: { category: obj.id }
                };
            });
            $('#cus').devbridgeAutocomplete({
                lookup: nhl,
                minChars: 1,
                onSelect: function (suggestion) {
                    $("#cusId").val(suggestion.data.category);
                },
                showNoSuggestionNotice: true,
                noSuggestionNotice: 'Sorry, no matching results'
            });
        });

        //项目经理
        CertusFormAjax.ajax("findSpUserList",{},function (response) {
            var nhlTeams = [];
            var data = response.data;
            for (var i=0;i<data.length;i++){
                var arr={};
                arr.name=data[i].userName+"["+data[i].positonName+"]";
                arr.id = data[i].userId;
                nhlTeams.push(arr);
            }
            //自动补全
            var nhl = $.map(nhlTeams, function (obj) {
                return {
                    value: obj.name,
                    data: { category: obj.id }
                };
            });
            //项目经理
            $('#proMgName').devbridgeAutocomplete({
                lookup: nhl,
                minChars: 1,
                onSelect: function (suggestion) {
                    $("#proMgId").val(suggestion.data.category);
                },
                showNoSuggestionNotice: true,
                noSuggestionNotice: 'Sorry, no matching results'
            });
            //销售经理
            $('#proXsName').devbridgeAutocomplete({
                lookup: nhl,
                minChars: 1,
                onSelect: function (suggestion) {
                    $("#proXsId").val(suggestion.data.category);
                },
                showNoSuggestionNotice: true,
                noSuggestionNotice: 'Sorry, no matching results'
            });
            //产品经理
            $('#proCpName').devbridgeAutocomplete({
                lookup: nhl,
                minChars: 1,
                onSelect: function (suggestion) {
                    $("#proCpId").val(suggestion.data.category);
                },
                showNoSuggestionNotice: true,
                noSuggestionNotice: 'Sorry, no matching results'
            });
            //交付经理
            $('#proJfName').devbridgeAutocomplete({
                lookup: nhl,
                minChars: 1,
                onSelect: function (suggestion) {
                    $("#proJfId").val(suggestion.data.category);
                },
                showNoSuggestionNotice: true,
                noSuggestionNotice: 'Sorry, no matching results'
            });
        });

        // CertusFormAjax.ajax("getPdlines", {}, function (response) {
        //     $scope.dd = response.data;
        // });

        CertusFormAjax.ajax("findComList", {}, function (response) {
            $scope.data = response.data;
        });

        //提交立项信息
        $(".submit").click(function () {
            if (!certusValidateNotnull()) {
                return;
            }
            //判断项目名称是否存在
            CertusFormAjax.ajax("isHasProName", { "proName": $("#proName").val() }, function (res) {
                if (res.data == true) {
                    layer.msg("项目名称已存在！", { "time": 1000 });
                    return;
                } else {
                    var ckProMgUser = $("#proMgName").val();
                    var ckProMgId = $("#proMgId").val();
                    if (ckProMgUser.indexOf(ckProMgId)==-1){
                        layer.msg("请选择正确的格式的项目经理");
                        return;
                    }
                    // var ckProXsUser = $("#proXsName").val();
                    // var ckProXsId = $("#proXsId").val();
                    // if (ckProXsUser.indexOf(ckProXsId)==-1){
                    //     layer.msg("请选择正确的格式的销售经理");
                    //     return;
                    // }
                    // var ckProCpName = $("#proCpName").val();
                    // var ckProCpId = $("#proCpId").val();
                    // if (ckProCpName.indexOf(ckProCpId)==-1){
                    //     layer.msg("请选择正确的格式的产品经理");
                    //     return;
                    // }
                    // var ckProJfName = $("#proJfName").val();
                    // var ckProJfId = $("#proJfId").val();
                    // if (ckProJfName.indexOf(ckProJfId)==-1){
                    //     layer.msg("请选择正确的格式的交付经理");
                    //     return;
                    // }

                    var sTime = $("#datetimeKs").val();
                    var endTime = $("#datetimeJs").val();
                    if (endTime == "") {
                        layer.msg("结束日期不能为空", {
                            time: 1000
                        });
                        return;
                    }
                    if (sTime != "") {
                        var startTime = new Date(sTime.replace("/", "-").replace("/", "-"));
                        var endTimes = new Date(endTime.replace("/", "-").replace("/", "-"));
                        if (startTime > endTimes) {
                            layer.msg("开始日期不能大于结束日期", {
                                time: 1000
                            });
                            return;
                        }
                    } else {
                        layer.msg("开始日期不能为空", {
                            time: 1000
                        });
                        return;
                    }

                    var pdLineCodes = "";
                    // if (!$("#pdLine").is(":hidden")) {
                    //     $("#pdLine").find("input[type='checkbox']:checked").each(function (i, n) {
                    //         if (i == 0) {
                    //             pdLineCodes += $(n).val();
                    //         } else {
                    //             pdLineCodes += "," + $(n).val();
                    //         }
                    //     });
                    //     if (pdLineCodes == "") {
                    //         layer.msg("至少选择一个产品线", { time: 1000 });
                    //         return;
                    //     }
                    // }
                    if ($("#product").val()==""){
                        layer.msg("请选择所属产品！");
                        return;
                    }

                    var pduList = [];
                    var pduArr = {};
                    pduArr.productId = $("#product").val();
                    pduArr.productName = $('#product option:selected').text();
                    pduList.push(pduArr);

                    var arr = $("form").serializeArray();
                    var data = {};
                    for (var i = 0; i < arr.length; i++) {
                        data[arr[i].name] = arr[i].value;
                    };
                    data.proType = "XS";
                    data.warnData = warnData;
                    data.otherMoneyData = otherMoneyData;
                    data.targetDate = targetDate;
                    data.rlData = rlData;
                    data.company = $("#company").val();
                    data.pduData = pduList;

                    console.log(data)

                    var index = layer.load(1);
                    CertusFormAjax.ajax('toNewLx',{"data":JSON.stringify(data)},function () {
                        //关闭
                        layer.close(index);
                        layer.msg("申请成功！");
                        window.history.back();
                    });
                }
            });
        });

        this.showRl = function () {
            $(".hiderl").show();
        }
    }

    function ckIsN(value) {
        if (value == "N") {
            $("#pdLine").find("input[type='checkbox']").each(function (i, n) {
                if ($(n).val() != "N") {
                    $(n).attr("checked", false);
                }
            });
        } else {
            $("#pdLine").find("input[type='checkbox']").each(function (i, n) {
                if ($(n).val() == "N") {
                    $(n).attr("checked", false);
                }
            });
        }
    }
    
    function showtarget() {
        $("#proTarget").val("");
        $("#tarFinishTime").val("");
        $(".tarhideproin").show();
    };
    function showproin() {
        $("#wntyName").val("");
        $("#wntyDesc").val("");
        $("#finishTime").val("");
        $(".hideproin").show();
    };

    //项目其他费用表单显示隐藏
    function hideother() {
        $(".hideother").hide();
    };

    function showother() {
        $(".hideother").show();
    };
    function tarhideproin() {
        $(".tarhideproin").hide();
    };
    //项目指标表单显示隐藏
    function hideproin() {
        $(".hideproin").hide();
    };

    //其他费用表单
    var otherColumns = [{
        id: 'comments',
        title: '事由',
        type: 'string',
        columnClass: 'text-left',
    }, {
        id: 'bugetMoney',
        title: '预算金额',
        type: 'string',
        width: 150,
        columnClass: 'text-center',
        resolution: function (value, record, column, grid, dataNo, columnNo) {
            var content = '￥' + value + '元';
            return content;
        }
    }, {
        id: 'budgetBegin',
        title: '开始时间',
        type: 'string',
        width: 100,
        columnClass: 'text-center',
    }, {
        id: 'budgetEnd',
        title: '结束时间',
        type: 'string',
        width: 100,
        columnClass: 'text-center',
    }, {
        id: 'operation',
        title: '操作',
        width: 75,
        type: 'string',
        columnClass: 'text-center',
        resolution: function (value, record) {
            var content = '';
            content += '<button class="btn btn-xs btn-danger" onclick="deleteWarn(' + record.id + ');"><i class="fa fa-trash-o"></i>  删除</button>';
            return content;
        }
    }];
    var otherMoneyData = [];
    var otherOption = {
        lang: 'zh-cn',
        ajaxLoad: false,
        extraWidth: 20,
        // loadURL:'url',
        exportFileName: '其他费用',
        datas: otherMoneyData,
        columns: otherColumns,
        gridContainer: 'otherContainer',
        toolbarContainer: 'otherToolBarContainer',
        tools: '',
        pageSize: 10,
        pageSizeLimit: [10, 15, 20]
    };
    var otherGrid = $.fn.dlshouwen.grid.init(otherOption);
    otherGrid.load();

    var om = 1;
    function addOtherMoney() {
        var bugetMoney = $("#bugetMoney").val();
        if (bugetMoney == "" || bugetMoney == undefined || bugetMoney == null) {
            layer.msg("预算金额不能为空!");
            return;
        }
        var comments = $("#comments").val();
        if (comments == "" || comments == undefined || comments == null) {
            layer.msg("事由不能为空!");
            return;
        }
        var arr = {};
        arr.id = om;
        arr.bugetMoney = bugetMoney;
        arr.comments = comments;
        arr.moneyType = $("#moneyType").val();
        var budgetBegin = $("#oStartTime").val();
        var budgetEnd = $("#oEndTime").val();
        if (budgetBegin == null || budgetBegin == "" || budgetBegin == undefined) {
            layer.msg('开始日期不能为空!');
            return;
        }
        if (budgetEnd == null || budgetEnd == "" || budgetEnd == undefined) {
            layer.msg('结束日期不能为空!');
            return;
        }
        if (new Date(budgetBegin.replace("/", "-").replace("/", "-")) >
            new Date(budgetEnd.replace("/", "-").replace("/", "-"))) {
            layer.msg('开始日期不能大于结束日期!');
            return;
        }
        arr.budgetBegin = budgetBegin;
        arr.budgetEnd = budgetEnd;
        otherMoneyData.push(arr);
        om++;
        otherGrid.load();
        $(".hideother").hide();

        $("#bugetMoney").val("");
        $("#oStartTime").val("");
        $("#oEndTime").val("");
        $("#comments").val("");
    }
    //删除其他费用
    function deleteWarn(wid) {
        layer.confirm('确认删除此数据？', {
            btn: ['确认', '取消'] //按钮
        }, function () {
            var dArr = {};
            for (var i = 0; i < otherMoneyData.length; i++) {
                if (otherMoneyData[i].id == wid) {
                    dArr = otherMoneyData[i];
                }
            }
            otherMoneyData.splice($.inArray(dArr, otherMoneyData), 1);
            otherGrid.load();
            layer.msg('删除成功');
        });
    }

    //项目指标表单
    // 立项信息-项目指标
    var proinColumns = [{
        id: 'wntyName',
        title: '指标名称',
        width: 150,
        type: 'string',
        columnClass: 'text-center',
    }, {
        id: 'wntyDesc',
        title: '指标描述',
        type: 'string',
        columnClass: 'text-left',
    }, {
        id: 'finishTime',
        title: '完成时间',
        type: 'string',
        width: 100,
        columnClass: 'text-center',
    }, {
        id: 'operation',
        title: '操作',
        width: 75,
        type: 'string',
        columnClass: 'text-center',
        resolution: function (value, record, column, grid, dataNo, columnNo) {
            var content = '';
            content += '<button class="btn btn-xs btn-danger" onclick="deleteWarnA(' + record.wid + ');"><i class="fa fa-trash-o"></i>  删除</button>';
            return content;
        }
    }];

    var warnData = [];

    var proinOption = {
        lang: 'zh-cn',
        ajaxLoad: false,
        extraWidth: 20,
        // loadURL:'url',
        exportFileName: '项目指标',
        datas: warnData,
        columns: proinColumns,
        gridContainer: 'proinContainer',
        toolbarContainer: 'proinToolBarContainer',
        tools: '',
        pageSize: 10,
        pageSizeLimit: [10, 15, 20]
    };
    var proinGrid = $.fn.dlshouwen.grid.init(proinOption);
    proinGrid.load();
    var warnI = 1;
    $(".warnSubmit").on('click', function () {
        var wntyName = $("#wntyName").val();
        if (wntyName == "" || wntyName == null || wntyName == undefined) {
            layer.msg("指标名称不能为空！");
            return;
        }
        var wntyDesc = $("#wntyDesc").val();
        if (wntyDesc == "" || wntyDesc == null || wntyDesc == undefined) {
            layer.msg("指标描述不能为空！");
            return;
        }
        var finishTime = $("#finishTime").val();
        if (finishTime == "" || finishTime == null || finishTime == undefined) {
            layer.msg("完成时间不能为空！");
            return;
        }
        var warnArr = {};
        warnArr.wntyName = wntyName;
        warnArr.wntyDesc = wntyDesc;
        warnArr.finishTime = finishTime;
        warnArr.wid = warnI;
        warnData.push(warnArr);
        warnI++;
        proinGrid.load();
        $(".hideproin").hide();
    });

    //删除项目指标
    function deleteWarnA(wid) {
        layer.confirm('确认删除此数据？', {
            btn: ['确认', '取消'] //按钮
        }, function () {
            var dArr = {};
            for (var i = 0; i < warnData.length; i++) {
                if (warnData[i].wid == wid) {
                    dArr = warnData[i];
                }
            }
            warnData.splice($.inArray(dArr, warnData), 1);
            proinGrid.load();
            layer.msg('删除成功');
        });
    }

    // 立项信息-项目目标
    var prointColumns = [{
        id: 'proTarget',
        title: '项目目标',
        type: 'string',
        columnClass: 'text-left',
    }, {
        id: 'finishTime',
        title: '完成时间',
        type: 'string',
        width: 100,
        columnClass: 'text-center',
    }, {
        id: 'operation',
        title: '操作',
        type: 'string',
        width: 75,
        columnClass: 'text-center',
        resolution: function (value, record, column, grid, dataNo, columnNo) {
            var content = '';
            content += '<button class="btn btn-xs btn-danger" onclick="deleteTarget(' + record.wid + ');"><i class="fa fa-trash-o"></i>  删除</button>';
            return content;
        }
    }];
    var targetDate = [];
    //项目目标列表
    var prointOption = {
        lang: 'zh-cn',
        ajaxLoad: false,
        extraWidth: 20,
        // loadURL:'url',
        exportFileName: '项目目标',
        datas: targetDate,
        columns: prointColumns,
        gridContainer: 'targetContainer',
        tools: ''
    };
    var prointGrid = $.fn.dlshouwen.grid.init(prointOption);
    prointGrid.load();
    var tarid = 1;
    $(".targetSubmit").on('click', function () {
        var proTarget = $("#proTarget").val();
        var finishTime = $("#tarFinishTime").val();
        if (proTarget == "") {
            layer.msg("项目目标不能为空");
            return;
        }
        if (proTarget.length > 120) {
            layer.msg("项目目标不能大于120字");
            return;
        }
        if (finishTime == "") {
            layer.msg("完成时间不能为空");
            return;
        }
        var targetArr = {};
        targetArr.proTarget = proTarget;
        targetArr.finishTime = finishTime;
        targetArr.wid = tarid;
        targetDate.push(targetArr);
        tarid++;
        prointGrid.load();
        $(".tarhideproin").hide();
    });
    //删除项目目标
    function deleteTarget(wid) {
        layer.confirm('确认删除此数据？', {
            btn: ['确认', '取消'] //按钮
        }, function () {
            var dArr = {};
            for (var i = 0; i < targetDate.length; i++) {
                if (targetDate[i].wid == wid) {
                    dArr = targetDate[i];
                }
            }
            targetDate.splice($.inArray(dArr, targetDate), 1);
            prointGrid.load();
            layer.msg('删除成功');
        });
    }

    //添加人力成本
    function hideRl() {
          $(".hiderl").hide();
        cleanRl();
    }
    var rlColumns = [{
        id: 'roleName',
        title: '角色',
        type: 'string',
        columnClass: 'text-center'
    },{
        id: 'rtMoney',
        title: '级别',
        type: 'string',
        columnClass: 'text-center',
        resolution: function (value, record, column, grid, dataNo, columnNo) {
            var content = '';
            if (value=="1"){
                content = "低";
            }else if (value=="2"){
                content = "中";
            }else{
                content = "高";
            }
            return content;
        }
    },{
        id: 'beginTime',
        title: '开始时间',
        type: 'string',
        columnClass: 'text-center',
    }, {
        id: 'endTime',
        title: '结束时间',
        type: 'string',
        columnClass: 'text-center',
    },{
        id: 'rtNum',
        title: '天数',
        type: 'string',
        columnClass: 'text-center',
    },{
        id: 'pNum',
        title: '人数',
        type: 'string',
        columnClass: 'text-center',
    }, {
        id: 'comments',
        title: '说明',
        type: 'string',
        columnClass: 'text-center',
    }, {
        id: 'operation',
        title: '操作',
        width: 75,
        type: 'string',
        columnClass: 'text-center',
        resolution: function (value, record, column, grid, dataNo, columnNo) {
            var content = '';
            content += '<button class="btn btn-xs btn-danger" onclick="deleteRl(' + record.rid + ');"><i class="fa fa-trash-o"></i>  删除</button>';
            return content;
        }
    }];
    var rlData = [];
    var rlOption = {
        lang: 'zh-cn',
        ajaxLoad: false,
        extraWidth: 20,
        // loadURL:'url',
        exportFileName: '人力成本列表',
        datas: rlData,
        columns: rlColumns,
        gridContainer: 'rlContainer',
        toolbarContainer: 'rlToolBarContainer',
        tools: ''
    };
    var rlGrid = $.fn.dlshouwen.grid.init(rlOption);
    rlGrid.load();
    var rid = 1;
    $(".rlSubmit").click(function () {
        var rArr = {};
        var userName = $('#rluserName option:selected').text();
        var userId = $("#rluserName").val();
        if (userId==""){
            layer.msg("请选择角色！");
            return;
        }
        var rtMoney = $("#rtMoney").val();
        var rlBeginTime = $("#rlBeginTime").val();
        var rlEndTime = $("#rlEndTime").val();
        if (rlBeginTime==""||rlEndTime==""){
            layer.msg("请输入使用周期！");
            return;
        }
        var xzRt = daysBetween(rlBeginTime,rlEndTime)+1;
        var rtNum = $("#rtNum").val();
        if (rtNum==""||rtNum==0){
            layer.msg("请输入天数！");
            return;
        }
        if (rtNum>xzRt){
            layer.msg("天数超出周期时间！");
            return;
        };

        var pNum = $("#pNum").val();
        if (pNum==""||pNum==0){
            layer.msg("请输入人数！");
            return;
        }
        var rlComments = $("#rlComments").val();
        rArr.roleName = userName;
        rArr.roleId = userId;
        rArr.rtMoney = rtMoney;
        rArr.beginTime = rlBeginTime;
        rArr.endTime = rlEndTime;
        rArr.comments = rlComments;
        rArr.pNum = pNum;
        rArr.rtNum = rtNum;
        rArr.rid = rid;
        //判断成员是否已经存在
        for(var i=0;i<rlData.length;i++){
            if (rlData[i].roleId==userId){
                layer.msg("成员已经存在！");
                return;
            }
        }
        rid++;
        rlData.push(rArr);
        rlGrid.load();
        $(".hiderl").hide();
        cleanRl()
    });

    //删除人力
  function deleteRl(rid) {
      layer.confirm('确认删除此数据？', {
          btn: ['确认', '取消'] //按钮
      }, function () {
          var dArr = {};
          for (var i = 0; i < rlData.length; i++) {
              if (rlData[i].rid == rid) {
                  dArr = rlData[i];
              }
          }
          rlData.splice($.inArray(dArr, rlData), 1);
          rlGrid.load();
          layer.msg('删除成功');
      });
  }
  function cleanRl() {
      $("#rluserName").val("");
      $("#rlBeginTime").val("");
      $("#rlEndTime").val("");
      $("#rlComments").val();
  }

  function daysBetween(sDate1,sDate2){
      //Date.parse() 解析一个日期时间字符串，并返回1970/1/1 午夜距离该日期时间的毫秒数
      var time1 = Date.parse(new Date(sDate1));
      var time2 = Date.parse(new Date(sDate2));
      var nDays = Math.abs(parseInt((time2 - time1)/1000/3600/24));
      return  nDays;
  };
</script>